<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery-3.7.1.min.js"></script>
    <style>
       img {
       
        height: 500px;
        width: 285px;
           }
    
       
    </style>
   
</head>
<body>
      <img class="img1" src="xinyu1.jpg" alt="小姐姐">
      <img class="img2" src="" alt="">


    <script>
      /*  var content=$("img").attr("src");
        console.log(content);  */

        var content=$(".img1").attr("alt")
       


        //同时设置多个属性
        $(".img2").attr("src","xinyu1.jpg")
        $(".img2").attr({
            src:"./xinyu1.jpg",
            alt:"美女",
            title:"小姐姐"
        })

        
    </script>
</body>
</html>